

(function() {
	jQuery.validator.addMethod("isPhone", function(value, element) {
        var length = value.length;
        var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
        return this.optional(element) || (length == 11 && mobile.test(value));
       }, "请填写正确的手机号码");
	jQuery.validator.addMethod("isPassword", function(value, element) {
        var password = /^(?![^a-zA-Z]+$)(?!\D+$)/;
        return this.optional(element) || (password.test(value));
       }, "密码必须包含数字和字母");
	jQuery.validator.addMethod("isCertificateCode", function(value, element) {
        var certificateCode = /(^\d{15}$)|(^\d{17}(\d|X|x)$)/;
        return this.optional(element) || (certificateCode.test(value));
       }, "请填写正确的身份证号码");
	jQuery.validator.addMethod("isOfficePhone", function(value, element) {
        var officePhone = /(\d{3}-\d{8}|\d{4}-\d{7})|(^1[3|4|5|6|7|8][0-9]\d{4,8}$)/;
        return this.optional(element) || (officePhone.test(value));
       }, "请填写正确的办公电话");
	jQuery.validator.addMethod("isLoginName", function(value, element) {
        var loginName = /^[a-zA-Z0-9_]{6,16}$/;
        return this.optional(element) || (loginName.test(value));
       }, "请输入6到16位（字母，数字，下划线）");
	jQuery.validator.addMethod("isLongitude", function(value, element) {
        var longitude = /^(\-|\+)?(((\d|[1-9]\d|1[0-7]\d|0{1,3})\.\d{0,6})|(\d|[1-9]\d|1[0-7]\d|0{1,3})|180\.0{0,6}|180)$/;
        return this.optional(element) || (longitude.test(value));
       }, "请确认经度格式是否正确");
	jQuery.validator.addMethod("isLatitude", function(value, element) {
        var latitude = /^(\-|\+)?([0-8]?\d{1}\.\d{0,6}|90\.0{0,6}|[0-8]?\d{1}|90)$/;
        return this.optional(element) || (latitude.test(value));
       }, "请确认纬度格式是否正确");
}());
